package com.woniuxy.platform.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniuxy.life.core.api.CommonResult;
import com.woniuxy.life.core.api.ResultCode;
import com.woniuxy.platform.dto.ApprovalUser;
import com.woniuxy.platform.service.ApprovalService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 流程审批表 前端控制器
 * </p>
 *
 * @author 杨青云
 * @since 2020-09-27
 */
@RestController
@RequestMapping("/platform/approval")
public class ApprovalController {

        @Resource
        ApprovalService approvalService;

        @GetMapping("/showapproval")
        public CommonResult<List<ApprovalUser>> showApproval(@RequestParam(value = "page",defaultValue = "1") Integer page,@RequestParam(value = "limit",defaultValue = "5") Integer limit){

            Page pagea=new Page(page,limit);
            List<ApprovalUser> approvalUsers=approvalService.showApproval(pagea);
            CommonResult<List<ApprovalUser>> commonResult=new CommonResult<List<ApprovalUser>>(
                    ResultCode.SUCCESS.getCode(),ResultCode.SUCCESS.getMessage());
            commonResult.setData(approvalUsers);

            return commonResult;
        }

}
